import request from "@/utils/request";
import type { GetTrademarkListRes } from "./model/trademarkModel";


const enum Api {
  getTrademarkList = "/admin/product/baseTrademark",
  addTrademarkItem = '/admin/product/baseTrademark/save',
  updateTrademark = "/admin/product/baseTrademark/update"
}

export const getTrademarkListApi = (page: number, limit: number) => {
  return request.get<any, GetTrademarkListRes>(
    Api.getTrademarkList + `/${page}/${limit}`
  );
};

export const delTrademarkItemApi = (id: number) => {
  return request.delete<any, GetTrademarkListRes>(
    `/admin/product/baseTrademark/remove/${id}`
  )
}

export const addTrademarkItemApi = (logoUrl: string, tmName: string) => {
  return request.post<any, null>(
    Api.addTrademarkItem,
    {
      "logoUrl": logoUrl,
      "tmName": tmName,
    }
  )
}

export const updateTrademarkApi = (id: number, logoUrl: string, tmName: string) => {
  return request.post<any, null>(
    Api.updateTrademark,
    {
      id,
      logoUrl,
      tmName
    }
  )
}